/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elementsDefense;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

/**
 *
 * @author Ricardo
 */
public class EBus {
    public static enum Property{WAVE_NUMBER,WAVE_COUNTDOWN,ENEMY_COUNT,GOLD,HITPOINTS};
    private static final Object owner=new Object();
    private static PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(owner);
    
    
    //--------------------------------------------------------------------------------------MVC
    public static void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    public static void addPropertyChangeListener(Property property, PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(property.toString(), listener);
    }

    public static void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }

    public static void firePropertyChange(Property property, Object oldValue, Object newValue) {
        propertyChangeSupport.firePropertyChange(property.toString(), oldValue, newValue);
    }

    //------------------------------------------------------------------------------------ /MVC
    
}
